﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Threading;
namespace EC_Socket
{
    public partial class Form1 : Form
    {


        public EC_Server server = new EC_Server();
        public EC_Client client = new EC_Client();
        public Form1()
        {
            InitializeComponent();
        }

        protected string a;

        private void button1_Click(object sender, EventArgs e)
        {
            
            server.StartServer();
     
        }
        protected void Test()
        {
            a = "bcd";
          //  MessageBox.Show(a);
          

        }

        private void button2_Click(object sender, EventArgs e)
        {
            //服务器连接
     
            client.ConnectToServer("127.0.0.1");
            
        }

        private void button3_Click(object sender, EventArgs e)
        {
            //传数据
            string str = "abcdefghsi";
            for (int i = 0; i < 2000; i++)
            {
                str += "abcdefghsi";
            }
            str += "1234567";
            client.SendData(str, str.Length);
        }

        private void Form1_FormClosed(object sender, FormClosedEventArgs e)
        {
            server.Close();
            client.Close();           
        }

        private void button4_Click(object sender, EventArgs e)
        {
            string str = "abcdefghsi";
            for (int i = 0; i < 120; i++)
            {
                str += "abcdefghsi";
            }
            str += "1234567";
            server.SendData(str, str.Length,0);
        }
    }
}
